import { createApp } from 'vue'
import './style.less'
import App from './App.vue'
import router from './router/index'
import { createPinia } from 'pinia'
import { Http } from '@/utils/http'
import 'element-plus/dist/index.css'
import 'element-plus/theme-chalk/display.css'
import ElementPlus from 'element-plus'
import 'vant/lib/index.css'
import { Dialog, Swipe, SwipeItem, Image as VanImage, Cell, CellGroup, Popup, IndexBar, IndexAnchor, DatePicker, Area, Picker, ConfigProvider, List, PullRefresh, Lazyload } from 'vant'
import components from '@/components/index'
import 'viewerjs/dist/viewer.css'
import VueViewer from 'v-viewer'
import { ElMessage, ClickOutside } from 'element-plus'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

// 持久化存储pinia
import piniaPluginPersist from 'pinia-plugin-persist'

Http.init()

const store = createPinia()
store.use(piniaPluginPersist)

const app = createApp(App)

app.use(Dialog);
app.use(Area);
app.use(DatePicker);
app.use(Picker);
app.use(List);
app.use(PullRefresh);
app.use(Lazyload);
app.use(ConfigProvider);
app.use(VanImage);
app.use(Popup);
app.use(Cell);
app.use(CellGroup);
app.use(store)
app.use(router)
app.use(ElementPlus)
app.use(Swipe)
app.use(SwipeItem)
app.use(components)
app.directive('clickoutside', ClickOutside)
app.config.globalProperties.$message = ElMessage;
app.provide('$abc', ElMessage)
app.use(VueViewer, {
    defaultOptions: {
        zIndex: 9999,
        inline: false, // 默认值：false。启用内联模式。
        button: true, // 右上角关闭按钮
        navbar: false, // 指定导航栏(图片组)的可见性。
        title: true, //指定标题的可见性和内容。
        toolbar: false, // 指定工具栏及其按钮的可见性和布局
        tooltip: true, //放大或缩小时显示带有图像比率（百分比）的工具提示。
        movable: false, // 启用以移动图像。
        zoomable: true, // 启用以缩放图像。
        rotatable: true, // 启用以旋转图像
        scalable: true, // 用以缩放图像。
        transition: false, // 为某些特殊元素启用CSS3转换。
        fullscreen: false, // 启用以在播放时请求全屏。
        keyboard: true, //启用键盘支持。
        url: 'src', //默认值：“src”。定义获取原始图像URL以供查看的位置。
    }
})
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}
app.use(IndexBar);
app.use(IndexAnchor);

app.mount('#app')
